<template>
  <section class="_m-2">
    <div class="title d-flex justify-content-between">
      <h3>最新评论</h3>
      <h3>{{totalCount}} 人评论</h3>
    </div>

    <ul class="p-2_">
      <li class="p-2 border-bottom" v-for="item in discussList" :key="item.id">
        <div class="d-flex discuss-list-ul">
          <div class="avator">
            <img :src="item.usersVo.avator" alt="头像" v-if="item.usersVo.avator != null"/>
            <img src="~assets/img/head.png" alt="头像" v-else/>
          </div>
          <div class="info flex-1">
            <h2 class="d-flex justify-content-between">
              <div>{{item.usersVo.nickName}}</div>
              <div class="time">
                {{item.createTime|date }}
              </div>
            </h2>
            <p>{{item.discussContent}}</p>
          </div>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  name: "DiscussLists",
  props: {
    discussList: Array,
    totalCount: Number
  }
};
</script>

<style lang="stylus" scoped>
@import '~assets/css/style.styl';

section {
  background: #FFF;

  .title {
    height: 34px;
    font-size: 14px;
    line-height: 34px;

    h3 {
      padding-left: 2vw;
      padding-right: 2vw;
      position: relative;

      i {
        font-size: 12px !important;
        margin-right: 4px;
      }

      &:nth-child(1):after {
        content: '';
        width: 3px;
        height: 14px;
        display: inline-block;
        background: $colorPrimary;
        position: absolute;
        top: 10px;
        left: 0px;
        border-radius: 3px;
      }
    }
  }

  .discuss-list-ul {
    padding 10px 0

    .avator {
      margin-right: 10px;

      img {
        width: 25px;
        height: 25px;
        border-radius: 50%;
      }
    }

    .info {
      h2 {
        height: 25px;
        line-height: 20px;
        margin-bottom: 5px;
        color #33333394
        font-size 14px
      }

      p {
        ellipsis2();
        font-size: 14px;
        line-height: 18px;
        margin-left: 0px;
      }
    }
  }
}
</style>
